package com.shunwang.caipiao.analysis.numberInterval;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import com.shunwang.caipiao.analysis.CaiPiaoAnalysis;
import com.shunwang.caipiao.analysis.DataContext;
import com.shunwang.caipiao.data.container.NumberIntervalContainer;
import com.shunwang.caipiao.data.container.NumberIntervalContainerCallBack;
import com.shunwang.caipiao.data.container.Top5NumberCallBack;
import com.shunwang.caipiao.vo.NumberIntervalDetailVo;
import com.shunwang.caipiao.vo.NumberIntervalVo;
import com.shunwang.caipiao.vo.SeatNumbers;

public class NumberIntervalTopAnalysis implements CaiPiaoAnalysis<List<SeatNumbers>> {

	@Override
	public List<SeatNumbers> analysis(DataContext context) {
		NumberIntervalContainer container = (NumberIntervalContainer)context.getObj("NumberIntervalContainerKey");
		NumberIntervalContainerCallBack callback = new Top5NumberCallBack();
		Set<Integer> seats = container.getSeats();
		List<SeatNumbers> result = new ArrayList<SeatNumbers>();
		for(Integer seat : seats){
			List<NumberIntervalDetailVo> vos = (List<NumberIntervalDetailVo>)container.getTopAvgInterval(seat,callback);
			if(vos != null && vos.size() > 0){
				result.add(new SeatNumbers(seat,vos));
			}
		}
		return result;
	}

	
}
